
<%@page import="com.ksyzt.gwt.shared.module.SiteInformation"%>
<%@page import="com.ksyzt.ksite2.shared.modle.SITEINFOObj"%>
<%@page import="com.ksyzt.ksite2.server.common.Application"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="java.net.URLDecoder"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";

	Application app = new Application(request, response);

	SiteInformation siteInfo = app.getApplicationPageData().siteInfo;
	
	String url = "";
	url = app.parameterAsString("url", "");
	if (url != "") {
		url = URLDecoder.decode(url);
	} else {
		url = basePath + "/";
	}
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title><%=siteInfo.getName()%>-登录</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="<%=siteInfo.getKeywords()%>">
<meta http-equiv="description" content="<%=siteInfo.getSummary()%>登录">

<script type="text/javascript" src="dwr/engine.js">
</script>
<script type="text/javascript" src="js/jquery.js">
</script>
<script type="text/javascript" src="dwr/interface/UserUtil.js">
</script>
<script type="text/javascript">
var redirecturl = '<%=url%>';


	function login() {
		message("");
		var un = $("#txtNAME").val();
		var pwd = $("#txtPWD").val();

		if (un == "") {
			message("输入用户名");
			return;
		}
		if (pwd == "") {
			message("输入密码");
			return;
		}
		UserUtil.userlogin(un, pwd, "", on_data);

	}
	function on_data(data) {
		if (data[0] == "1") {

			location.href = redirecturl;
		} else {
			message(data[1]);
		}
	}

	function load() {
		$("#content  input").focus(function() {
			$(this).parent().removeClass().addClass("input_focus");
		}).blur(function() {
			$(this).parent().removeClass().addClass("input_normal");
		});
		var un = "";
		un = "";

		$("#txtNAME").val(un);
		if (un == null || un == "") {
			$("#txtNAME").focus();
		} else {
			$("#txtPWD").focus();
		}

	}
	function message(txt) {
		$("#lbMessage").html(txt);
	}

	function keyup(e) {
		e = e ? e : window.event;
	    var keyCode = e.which ? e.which : e.keyCode;
		
		if (keyCode == 13) {
			login();
		}
	}
</script>
<style type="text/css">
* {margin:0px 0px 0px 0px;padding:0px 0px 0px 0px;}

.page_wrap {
	text-align: center;
	margin: 0px auto;
	width: 100%;
}

.login_pannel {
	background-image: url(images/background.png);
	background-repeat: no-repeat;
	position: relative;
	width: 1024px;
	height: 612px;
	margin: auto;
}

.table_login {
	position: absolute;
	left: 500px;
	top: 305px;
}

.btn_login {
	background-image: url("images/btn_login.png");
	width: 141px;
	height: 40px;
	line-height: 40px;
	display: block;
}

.btn_login:HOVER {
	background-image: url("images/btn_login_over.png");
}

.input_name {
	width: 200px;
	height: 30px;
	line-height: 30px;
	font-size: 14px;
}

.input_pwd {
	width: 200px;
	height: 30px;
	line-height: 30px;
}

.label {
	font-size: 14px;
	font-weight: bold;
	color: #000;
}
#lbMessage
{
	font-style: italic;
	color: red;
}
</style>
</head>

<body onload="load()">

	<div class='page_wrap'>
		<div class='login_pannel'>
			<table class='table_login' cellpadding="3" cellspacing="3">
				<tr>
					<td><div class="label">用户名</div>
					</td>
					<td><input class="input_name" id="txtNAME" />
					</td>
				</tr>
				<tr>
					<td><div class="label">密 码</div>
					</td>
					<td><input type="password" onkeydown="keyup()"
						class='input_pwd' id="txtPWD" /></td>
				</tr>
				<tr>
					<td colspan="2" align="center"><a href="javascript:void(0)"
						onclick="login()" class="btn_login"></a>
					</td>
				</tr>
				<tr>
					<td colspan="2" align="center"><div id="lbMessage"></div>
					</td>
				</tr>
			</table>
		</div>
	</div>


</body>
</html>
